package com.tjetc.dao;


import com.tjetc.domain.po.District;
import com.tjetc.domain.po.Pass;
import com.tjetc.domain.vo.PassVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PassMapper {
    List<Pass> list(Integer vocalcontenId);

    @Select("select id,name,price from district")  // type是index   extra是Using index 走了覆盖索引
    List<District> districtList();

    @Select("SELECT p.id ,p.count ,d.price,d.name FROM  pass p ,district d WHERE  p.district_id = d.id  and  p.id=#{id}") //type是 const
    PassVo findById(Integer id);

    @Update("update pass set count  = count  -#{ num}  where id =#{id}")
    void reduceCount(Integer num, Integer id);



    @Select("select id , district_id, vocalconten_id,count from pass ")   // type是index   extra是Using index 走了覆盖索引
    List<Pass> findAll();


    void updateCountByPassId(@Param("num") Integer num, @Param("passId") Integer passId);

}
